-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extract common cache data preparation logic to new method #20015
Extract common cache data preparation logic to new method #20015
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #20015 +/- ##
==========================================
+ Coverage 46.70% 48.01% +1.30%
==========================================
Files 445 445
Lines 43896 43890 -6
==========================================
+ Hits 20503 21075 +572
+ Misses 23393 22815 -578
☔ View full report in Codecov by Sentry. |
That's a good refactor but it's a cache and one more function call may matter on many-many cache calls. Are you willing to compare performance? |
I performed a performance test to check the impact of the new method. I ran the test in a loop with 1 million iterations:
I ran the tests three times:
I think the refactored method is slightly slower, but the difference is minimal and likely won't significantly impact real-world performance. These tests were done using an array cache. In other cache configs, the time taken for network or disk I/O operations would be much greater than in-memory array cache. Therefore, the overhead of an additional function call is likely negligible compared to the time spent on these I/O operations. |
Alright. Looks good to me. |
870316e
to
abcd82f
Compare
@samdark any plan for this PR? |
Refactor the
multiSet
andmultiAdd
methods by extracting the common logic for preparing cache data into a new private method calledprepareCacheData
.